import CrudService from '../global/CrudService'

let instance = null

// 后端路径
const prefix = '/rptWork'

class Service extends CrudService {
	constructor() {
		super(prefix)
		this.getListPath = `${prefix}/queryWorkList`
		this.addPath     = `${prefix}/doWorkInsert`
		this.deletePath  = `${prefix}/doWorkDelete`
		this.updatePath  = `${prefix}/doWorkUpdate`
		return instance || this
	}
	
	static getInstance() {
		if (!instance) {
			instance = new Service()
		}
		return instance
	}
	
	/*async setStart(id, is_start) {
		const query = this.qs({id, is_start})
		return this.post(`${prefix}/doTemplateSetStart?${query}`)
	}*/

	
	async queryPriorWorkList({id, template_id}) {
		const query = this.qs({ id, template_id })
		return this.get(`${prefix}/queryPriorWorkList?${query}`)
	}
	
}

export default Service.getInstance()
